﻿using SqlSugar;
using System;

namespace IconYuan.Model.Entity.Users
{
    /// <summary>
    /// 会员等级
    /// </summary>
    [SugarTable("uc_grade")]
    public class UserGrade
    {
        /// <summary>
        /// 自增
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        public int grade_id { get; set; }
        /// <summary>
        /// 等级名称
        /// </summary>
        public string name { get; set; } = string.Empty;
        /// <summary>
        /// 等级别名
        /// </summary>
        public string nick_name { get; set; } = string.Empty;
        /// <summary>
        /// 等级折扣(折扣率0-100)
        /// </summary>
        public int equity { get; set; } = 100;
        /// <summary>
        /// 升级条件
        /// </summary>
        public string upgrade { get; set; } = string.Empty;
        /// <summary>
        /// 状态(1启用 0禁用)
        /// </summary>
        public int status { get; set; } = 1;
        /// <summary>
        /// 是否删除
        /// </summary>
        public int is_delete { get; set; } = 0;
        /// <summary>
        /// 是否默认等级
        /// </summary>
        public int is_default{ get; set; } = 0;
        /// <summary>
        /// 店铺id
        /// </summary>
        public int store_id { get; set; }
        /// <summary>
        /// 有效期天数
        /// </summary>
        public int days { get; set; } = 0;
        /// <summary>
        /// 扩展设置
        /// </summary>
        public string ext { get; set; } = string.Empty;
        public DateTime create_time { get; set; }
        public DateTime update_time { get; set; }
        /// <summary>
        /// 等级权重(1-9999),数字越大权重越高
        /// </summary>
        public int weight { get; set; } = 1;
    }

    /// <summary>
    /// 等级扩展设置
    /// </summary>
    public class GradeExt
    {
        /// <summary>
        /// 直接赠送积分
        /// </summary>
        public int points { get; set; } = 0;
        /// <summary>
        /// 订单送积分倍数
        /// </summary>
        public int order_points_ratio { get; set; } = 0;
        /// <summary>
        /// 佣金比例
        /// </summary>
        public int brokerage_ratio { get; set; } = 0;
        /// <summary>
        /// 赠送消费金
        /// </summary>
        public decimal balance { get; set; } = 0;
        /// <summary>
        /// 赠送优惠券
        /// </summary>
        public string coupon_ids { get; set; } = string.Empty;
        /// <summary>
        /// 是否转赠: 0不可转赠, 1 可转赠
        /// </summary>
        public int is_transfer { get; set; } = 0;
        /// <summary>
        /// 是否首单免费: 0不免, 1 首单免费, 2 每次下单都免费
        /// </summary>
        public int is_first_free { get; set; }
        /// <summary>
        /// 免费商品id(每个商品只免费一件,第二件原价)
        /// </summary>
        public string goods_ids { get; set; } = string.Empty;
    }

}
